//# sourceURL=http://uMapApp/Earth/DataSourceView/GLTFDataSourceView
define([
    "mhjs/mhjs",
    "uMap/uMap",
    "uEarth/uEarth",
    "./PrimitiveDataSourceView"
], function (
    mhjs,
    uMap,
    uEarth,
    PrimitiveDataSourceView
) {

    function GLTFDataSourceView(option) {

        var _this = this;
        PrimitiveDataSourceView.call(_this, option);

        _this.model = new uMap.ModelPrimitive({
            objectOption: option
        });

        _this.model.on("loaded", function (model) {

            _this.model.on("click", function () {
                if (_this.layer.app.debug.isDebug) {
                    _this.layer.app.debug.transformPanel.title = _this.title;
                    _this.layer.app.debug.transformPanel.open(_this.model.transform);
                }
            });

        });


    }

    var _class = GLTFDataSourceView;

    mhjs.Inherit(_class, PrimitiveDataSourceView);

    Object.defineProperties(_class.prototype, {
        "open" : {
            value: function () {

                var _this = this;

                if (!_this.isOpened) {

                    _this.model.show = true;
                    _this.isOpened = true;

                    this.trigger("open");
                    this.trigger("toggle");
                }
            }
        },
        "close": {
            value: function () {

                var _this = this;

                _this.model.show = false;
                _this.isOpened = false;

                if (_this.isOpened) {
                    this.trigger("close");
                    this.trigger("toggle");
                }
            }
        }
    });

    return _class;

});